{% extends base.html %}

{% block head %}
<style type="text/css">
	.login-input {
	  width: 100%;
	  min-width: 200px;
    padding: 12px;
    border-radius: 0px;
    outline: none;
    margin-bottom: 5px;
    border: 1px solid #ccc;
 	}

 	.login-submit {
    padding: 12px 24px;
 		border-radius: 0px;
 		background-color: lightblue;
 	}
	
  .login-submit:hover {
		background-color: #27A9E3;
    border-radius: 0px;
	}
  
  .input-header {
    padding-top: 3px;
    size: 14px;
  }

  .nav {
    display: none;
  }

  .nav-left {
    display: none;
  }

  .x-body {
    left: 0px;
  }

  .login-box {
    width: 350px;
    background-color: #fff;
    margin: 0 auto;
    margin-top: 100px;
    border-radius: 5px;
  }
  
  .login-header {
    float: left;
    width: 100%;
    padding: 10px;
    background-color: #337ab7;
    color: white;
    border-radius: 5px 5px 0px 0px;
    /*border-radius: 0px;*/
    text-align: center;
  }

  .login-body {
    float: left;
    width: 100%;
    padding: 50px 10px 50px 10px;
    background-color: #fff;
  }

  .login-footer {
    float: left;
    width: 100%;
    background-color: #fff;
    padding: 0px 10px 10px 10px;
    text-align: center;
  }

  .nav-left-search {
    display: none;
  }

  @media screen and (max-width: 1000px) {
    .x-body {
      padding: 0px;
      background-color: transparent;
    }
    
    .main-content {
      padding: 0px;
    }

    .login-box {
      width: 100%;
      height: 100%;
      margin-top: 0px;
      margin-bottom: 0px;
    }

    .login-body {
      position: absolute;
      background-color: transparent;
    }

    .login-footer {
      position: absolute;
      bottom: 10px;
      text-align: center;
      background-color: transparent;
    }
  }
</style>
{% end %}

{% block body %}
    
<div class="login-box">
  <div class="login-header">登录</div>
  
  {% if error != "" and error != None %}
    <div class="col-md-12 error">{{error}}</div>
  {% end %}

  <div class="login-body">
    <form id="loginForm" name="loginForm" method="POST">
  		<input class="login-input" type="text" name="username" value="{{username}}" placeholder="账户名"/>
  		<input class="login-input" type="password" name="password" value="{{password}}" placeholder="密码"/>
      <input type="text" name="test" value="Test" class="hide">
  		<button class="login-submit login-input" type="submit" value="Login" id="loginBtn">登录</button>
  	</form>
  </div>

  <div class="login-footer">
    <a href="/" class="link">返回首页</a>
  </div>
</div>

<script type="text/javascript">
$(function () {
  function adjustLoginBody() {  
    var bodyWidth = $(".login-body").width();

    console.log("bodyWidth=" + bodyWidth);
    console.log("windowHeight=" + getWindowHeight());

    if (bodyWidth < 1000) {
      var height = $(".login-body").outerHeight();
      $(".login-body").css("top", (getWindowHeight() - height) / 2);
    }

    $(".mobile-search").hide();
    $(".x-body").css("margin-top", 0);
  }

  adjustLoginBody();
  window.onresize = adjustLoginBody;
})
</script>

{% end %}